package com.example.ex.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.ex.pojo.LoginUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface LoginUserMapper extends BaseMapper<LoginUser> {
    @Select("select * from login_user where username = #{userName} and password = #{password}")
    LoginUser login( String userName, String password);

    @Select("select * from login_user where username = #{userName}")
    LoginUser sel_name(String userName);

    @Select("select * from login_user where username = #{user} and question = #{question} and answer = #{answer}")
    LoginUser questionok(String user,String question,String answer);

    @Select("select avatar from login_user where username = #{userName}")
    String getAvatar(String userName);

    @Update("UPDATE login_user SET password=#{newPassword} WHERE username=#{username} ")
    int updatePassword(@Param("username") String username, @Param("newPassword") String newPassword);



//    @Insert("INSERT INTO login_user (username, password) VALUES (#{userName}, #{password})")
//    loginUser register(@Param("userName") String userName, @Param("password")String password);
}
